package myapp.com.xm.myapplication;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.xm.httpapi.Annotation.ViewL;
import com.xm.httpapi.BaseView.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import me.drakeet.multitype.MultiTypeAdapter;
import myapp.com.xm.myapplication.Adapter.Adapter4;
//https://github.com/drakeet/MultiType
@ViewL(R.layout.list_4)
public class List3Activity extends BaseActivity {

    private MultiTypeAdapter multiTypeAdapter=new MultiTypeAdapter();
    private List<Object> items = new ArrayList<>();
    private List<String> string = new ArrayList<>();
    private List<String> string2 = new ArrayList<>();
    private RecyclerView rv;

    @Override
    protected void initData(Bundle savedInstanceState) {
        rv=findViewById(R.id.rv);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        rv.setLayoutManager(layoutManager);
        multiTypeAdapter.register(String.class,new Adapter4(this,R.layout.list_item_4));
        multiTypeAdapter.register(String.class,new Adapter4(this,R.layout.list_item_4));
        rv.setAdapter(multiTypeAdapter);
        for(int i=0;i<20;i++){
            string.add("2222");
            string2.add("333333"+i);
        }
        items.addAll(string);
        items.addAll(string2);
        multiTypeAdapter.setItems(items);

    }

    @Override
    protected String showTitle() {
        return "1111";
    }
}
